﻿using UnityEngine;
using System.Collections;

public class Feeler : MonoBehaviour {
	[SerializeField]
	private CandyController owner;
	[SerializeField]
	private string direction;
	void OnTriggerEnter2D(Collider2D other) {
		if(owner.GetComponent<CandyController>().enabled){
			if(other.gameObject.tag=="Candy"){
				owner.GetComponent<CandyController>().AddNeightbor(other.gameObject ,direction);
			}
		}
	}
	void OnTriggerExit2D(Collider2D other) {
		if(owner.GetComponent<CandyController>().enabled){
			if(other.gameObject.tag=="Candy"){
				owner.GetComponent<CandyController>().RemoveNeighbor(direction);
			}
		}
	}

}
